home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / LISP Related / U. Mass AI & LISP Tools / MODULES / HNET / HNET-Printer.lisp < prev    next >
Encoding:
Text File  |  1990-06-22  |  1.1 KB  |  27 lines  |  [TEXT/CCL ]

  1. ;;; Prints contents of HNET.  Dan Suthers.
  2.  
  3. (in-package :HNET)
  4.  
  5. (export 'print-hnet-below-root)
  6.  
  7. (defun PRINT-HNET-BELOW-ROOT (hnet root 
  8.                                    &optional
  9.                                    (to-depth most-positive-fixnum)
  10.                                    (to-stream *standard-output*))
  11.   "print-hnet-below-root <hnet> <root>"
  12.   (check-type hnet symbol)
  13.   (check-type root symbol)
  14.   (check-type to-depth integer)
  15.   (check-type to-stream stream)
  16.   (assert (sm:gets 'hnet hnet)  (hnet) "[PRINT-HNET-BELOW-ROOT] Unknown hnet.")
  17.   (assert (defined-p root hnet) (root) "[PRINT-HNET-BELOW-ROOT] Unknown root.")
  18.   (labels ((printer (frontier depth)
  19.                   (when (and frontier (< depth to-depth))
  20.                       (dolist (term frontier)
  21.                            (declare (symbol term))
  22.                            (format to-stream "~%")
  23.                            (dotimes (x depth) (format to-stream "  "))
  24.                            (format to-stream "~S" term)
  25.                            (printer (subordinates term hnet) (1+ depth))))))
  26.     (printer (list root) 0)
  27.     hnet))